package com.bs.manager05.utils.exception;

import com.bs.manager05.utils.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 小姚
 * @pakeageName:com.bs.manager05.utils.exception
 * @ClassName:MyException
 * @Descirption:
 * @data 2022/12/18 19:42
 */
@RestControllerAdvice
public class MyException {

    //用户名为空
    @ExceptionHandler(NotUserNullException.class)
    public Result NotUserNull(NotUserNullException e){
         return Result.fail(e.getMessage());
    }

    //用户信息不存在
    @ExceptionHandler(NoUserException.class)
    public Result NotUserNull(NoUserException e){
        return Result.fail(e.getMessage());
    }

    //密码为空
    @ExceptionHandler(PasswordNullException.class)
    public Result pwdNull(PasswordNullException e){
         return Result.fail(e.getMessage());
    }

    //密码不正确
    @ExceptionHandler(PasswordEqualException.class)
    public Result pwdNull(PasswordEqualException e){
        return Result.fail(e.getMessage());
    }

    //用户状态不正常
    @ExceptionHandler(NoStatusException.class)
    public Result noStatus(NoStatusException e){
        return Result.fail(e.getMessage());
    }

    //该用户没有访问权限
    @ExceptionHandler(NoAuthException.class)
    public Result noAuth(NoAuthException e){
       return Result.fail(e.getMessage());
    }

}
